<%@ page contentType="text/html;charset=UTF-8" %>    
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${r'${pageContext.request.contextPath}'}"/>
<c:set var="sysName" value="${sysName}"/>
<c:set var="page_admin" value="${r'${pageContext.request.contextPath}'}/sendPage/${sysName}/admin"/>
<#if (sysModuleList?size > 0 )>
	<#list sysModuleList as process>
		<li class="treeview <#if process.actEname??>userSLock</#if>" userKey="${process.actEname!''}">
			<a href="javascript:void(0);">
			<i class="fa ${process.menuIcon!'fa-cog'}"></i> <span>${process.title!''}</span><i class="fa fa-angle-left pull-right"></i>
			</a>
			<ul class="treeview-menu" >
				<#assign subKey = "sub-"+process.moduleId>
				<#list sysSubList[subKey] as subObj>
				<li id="${subObj.code!''}" class="<#if subObj.actEname??>userSLock</#if>" userKey="${subObj.actEname!''}"><a <#if moduleType??><#if moduleType=='1'>data-load="true"<#else>data-pjax="true"</#if></#if> href="${r'${ctx}'}/sendPage${subObj.pageUrl!''}"><i class="fa ${subObj.menuIcon!'fa-circle-o'}"></i>${subObj.title}</a></li>
				</#list>  
			</ul>
		</li>
	</#list>  
</#if>

<script>
  	 	//part1、注入jquery.pjax 绑定A标签点击事件
      	$(document).pjax("[data-pjax='true'], a[data-pjax='true']", ".content-wrapper", {
       		fragment: ".content-wrapper"
      	});
	  	//$(document).pjax('a', '#pjax-container');
	  	$(document).on("pjax:send", function() { 
			//alert("发送完成");
		}); 
		$(document).on("pjax:complete", function(resultData) { 
	  		//alert("加载完成");
	  		$('.box').boxWidget();//pjax请求完成后，重新注入.box可伸缩事件
	  		showClickMenu();
		});
		
		//part2、注入jquery.load 绑定A标签load事件
		$("[data-load='true']").each(function(){
			var thisHref = $(this).attr("href");
			$(this).attr("load-url",thisHref);
			$(this).attr("href","javascript:;");
			$(this).click(function(){
				$(".content-wrapper").load(thisHref+" .content-wrapper>",function(resultData){
					 //alert(resultData);
					 $result = $(resultData);
			         $result.find("script").appendTo(".content-wrapper");//保证子页面的js内容能被引入进来
			         showClickMenu();
				});
			});
		});
 </script>